# -*- coding: utf-8 -*-

import MySQLdb

def opendb():
    db=MySQLdb.connect(host='localhost', db='xdouban', user='root', passwd='justsoso123', use_unicode=True)
    db.set_character_set('utf8')
    return db

def closedb(db):
    db.close()    

def escape_string(query):
    return MySQLdb.escape_string(query.encode("utf-8"))
